/*************************************************************************
 *
 * Deklarace datovych struktur - SPOLECNE FUNKCE
 * includovano z data.h souboru projektu
 *   
 * $Id: data.h 118 2007-01-22 16:46:40Z Ales $
 * 
 *************************************************************************/         

#define MAX_DESC_LEN        16
#define SENSOR_MAX_COUNT    16
#define MODE_MAX_COUNT      8

#define MODE_OFF            0
#define MODE_EKV            1
#define MODE_THSTAT         2


/* popisy senzoru a rezimu, jejich pocet; read only pro terminal
 * pristup z PC: DESC-READ(one), DESC-WRITE(one)
 */  
typedef struct {
    unsigned char sensor_count;
    char sensor_desc[SENSOR_MAX_COUNT][MAX_DESC_LEN];
    unsigned char mode_count;
    char mode_desc[MODE_MAX_COUNT][MAX_DESC_LEN];
} DESC_STRUCT;


/* informativni udaje predavane mozkem periodicky do vsech klientu; read only pro terminal
 * pristup z mozku: STDATA-WRITE(one)
 */ 
typedef struct {
    signed int temperature[SENSOR_MAX_COUNT];
    struct {
        unsigned char mode;
        signed char param;
        signed char wall;
        signed char dev;
        unsigned char led;
    } state;
} STDATA_STRUCT;


/* udaje nastavitelne pres menu; read-write pro terminal
 * pristup z mozku: RWDATA-READ(all,one), RWDATA-WRITE(all,one)
 * pristup do mozku: RWDATA-READ(all), RWDATA-WRITE(one)
 */  
typedef struct {
    unsigned char mode;
    signed char shift;
    unsigned char shift_length;
    signed char sw_mode;
    unsigned long sw_datetime;
} RWDATA_STRUCT;


/* inicializacni struktura pro start terminalu
 * pristup do mozku: INIT-READ(all)
 */  
typedef struct {
    RWDATA_STRUCT rwdata;
    STDATA_STRUCT stdata;
    unsigned long now;
} INIT_STRUCT;

extern void ReadEEPromBlock(void *pointer_ram, void *pointer_eeprom, unsigned char n);
extern void WriteEEPromBlock(void *pointer_ram, void *pointer_eeprom, unsigned char n);

